package suppressor

import (
	"github.com/stackrox/rox/central/vulnmgmt/vulnerabilityrequest/cache"
	"github.com/stackrox/rox/pkg/images/enricher"
	"github.com/stackrox/rox/pkg/sync"
)

var (
	once     sync.Once
	instance enricher.CVESuppressor
)

func initialize() {
	instance = New(cache.ActiveReqsCacheSingleton())
}

// Singleton provides the instance of CVESuppressor to use.
func Singleton() enricher.CVESuppressor {
	once.Do(initialize)
	return instance
}

// New returns an initialized cve suppressor.
func New(cache cache.VulnReqCache) enricher.CVESuppressor {
	return &cveSuppressorImpl{
		cache: cache,
	}
}
